package com.itheima.test;

import java.util.Random;

public class test10 {
    public static void main(String[] args) {
        //test9的另一种写法
        //直播抽奖

        //把奖池中的所有奖项打乱顺序
        int[] arr = {2,588,888,1000,10000};
        Random r = new Random();
        for(int i=0;i<arr.length;i++){
            int randomIndex = r.nextInt(arr.length);
            int temp = arr[i];
            arr[i] = arr[randomIndex];
            arr[randomIndex] = temp;
        }
        //遍历奖池
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);

        }
    }
}
